<?php
namespace app\admin\controller;
use app\common\controller\Adminbase;
use \think\Loader;
use \think\db;

/*
** 管理员用户 控制器
*/  

class Weixin extends Adminbase {
	
	// 优先加载
	public function _initialize() {
		parent::_initialize();
		
		
	}
	

	public function index() {
		
		
		dump(111);
		return view('index');
	}
	
	
	public function createmenu() {
		
		
		$wx_menu = db('wx_menu')->where('pid',0)->select();
		$this->assign(wx_menu,$wx_menu);
		return view('createmenu');
	}
	public function addmenusave(){
		
		$input = input('post.');
		
		if($input['cid']==0){
			$data['level'] = 1;
			$data['pid'] = 0;
		}else{
			$data['level'] = 2;
			$data['pid'] =$input['cid'];
		}
		$data['name'] = $input['name'];
		$data['type'] = $input['type'];
		$data['remark'] = $input['remark'];
		if(db('wx_menu') -> data($data) -> insert()){
			$this -> success('操作成功');
		}
		
		$this -> error('操作失败');
	}
}
